package com.slz3.business.module.wmsManagement.wmsStockOutItems.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.wmsManagement.wmsStockOutItems.domain.WmsStockOutItems;
import com.slz3.business.module.wmsManagement.wmsStockOutItems.domain.WmsStockOutItemsFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class WmsStockOutItemsTransactionalServiceImpl implements WmsStockOutItemsTransactionalService {

    @Override
    public WmsStockOutItems modify(WmsStockOutItems wmsStockOutItemsNew) {
        Repositorys.wmsStockOutItems.test();
        Repositorys.wmsStockOutItems.save(WmsStockOutItemsFactory.initBaseFields());
        System.err.println(1/0);
        wmsStockOutItemsNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.wmsStockOutItems.saveAndFlush(wmsStockOutItemsNew);
    }

    @Override
    public List<WmsStockOutItems> batchModify(List<WmsStockOutItems> wmsStockOutItemsList) {
        return Repositorys.wmsStockOutItems.saveAll(wmsStockOutItemsList);
    }
}
